{/* LAYOUT模板 */}
	<layout name="layout"/>
{/* LAYOUT模板 */}
{/* import Js,Css */}
	<js href="__PUBLIC__/js/admin/listTable.js"/>
	<js href="__PUBLIC__/js/admin/js.util.js"/>
	<css href="__PUBLIC__/css/admin/common.css"/>
	<js href="__PUBLIC__/js/admin/js.selectzone.js"/>
	
	<css href="__PUBLIC__/css/jquery-ui.css" />
	<js href="__PUBLIC__/js/core/jquery-ui.1.10.4.js" />
	<js href="__PUBLIC__/js/core/plugins.js"/>
{/* import js,css */}
<!-- [position] -->
	<include file="Template:position"/>
<!-- [position] -->

<!-- start goods form -->
<div class="tab-div">
	<form  action="__URL__/{$action}" method="post" name="theForm" onsubmit="return validate();">
		<table width="90%" id="general-table">
			<tr>
				<td class="label" align="right">{$Think.lang.keywords}</td>
				<td>
					<input type="text" name="keywords" size="30" />
					<input type="button" value="{$Think.lang.button_search}" onclick="searchGoods()" <if condition="$form_action eq 'update'"> disabled="true" </if>>
				</td>
			</tr>
			<tr>
				<td class="label" align="right">
					<a href="javascript:showNotice('noticegoodsid');" title="{$Think.lang.form_notice}">
						<img src="__PUBLIC__/image/admin/notice.gif" width="16" height="16" border="0" alt="{$Think.lang.form_notice}">
					</a>
					{$Think.lang.goodsid}
				</td>
				<td>
					<select name="goods_id">
						{$goods.option}
					</select>
					{$Think.lang.require_field}
					<br/>
					<span class="notice-span" <if condition="$help_open"> style="display:block"<else/> style="display:none" </if> id="noticegoodsid">
						{$Think.lang.notice_goodsid}
					</span>
				</td>
			</tr>
			<tr>
				<td class="label" align="right">
					<a href="javascript:showNotice('noticepackagePrice');" title="{$lang.form_notice}">
						<img src="__PUBLIC__/image/admin/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
					</a>
					{$Think.lang.integral}
				</td>
				<td>
					<input type="text" name="exchange_integral" maxlength="60" size="20" value="{$goods.exchange_integral}" />
					{$Think.lang.require_field}<br/>
					<span class="notice-span" <if condition="$help_open"> style="display:block"<else/> style="display:none"</if> id="noticepackagePrice">
						{$Think.lang.notice_integral}
					</span>
				</td>
			</tr>
			<tr>
				<td class="narrow-label" align="right">{$Think.lang.is_exchange}</td>
				<td>
					<input type="radio" name="is_exchange" value="1" <if condition="$goods['is_exchange'] eq 1">checked</if> > 
					{$Think.lang.isexchange}
					<input type="radio" name="is_exchange" value="0" <if condition="$goods['is_exchange'] eq 0">checked</if> > 
					{$Think.lang.isnotexchange}
					{$Think.lang.require_field}
				</td>
			</tr>
			<tr>
				<td class="narrow-label" align="right">{$Think.lang.is_hot}</td>
				<td>
					<input type="radio" name="is_hot" value="1" <if condition="$goods['is_hot'] eq 1">checked</if> > 
					{$Think.lang.ishot}
					<input type="radio" name="is_hot" value="0" <if condition="$goods['is_hot'] eq 0"> checked</if> > 
					{$Think.lang.isnothot}
					{$Think.lang.require_field}
				</td>
			</tr>
		</table>

		<div class="button-div" style="text-align:center;">
			<input type="hidden" name="act" value="{$form_action}" />
			<input type="submit" value="{$Think.lang.button_submit}"   />
			<input type="reset" value="{$Think.lang.button_reset}"  />
		</div>
	</form>
</div>
<!-- end goods form -->

<script language="JavaScript">

onload = function()
{
  // 开始检查订单
  //startCheckOrder();
}

function validate()
{
  var validator = new Validator('theForm');
  validator.isNullOption("goods_id", no_goods_id);
  validator.isNumber("exchange_integral", invalid_exchange_integral, true);


  return validator.passed();
}

function searchGoods()
{
    var filter = new Object;
    filter.keyword = document.forms['theForm'].elements['keywords'].value;
    //Ajax.call('exchange_goods.php?is_ajax=1&act=search_goods', filter, searchGoodsResponse, 'GET', 'jsON')
	$.ajax({
		url:'__URL__/search_goods',
		type:'get',
		dataType:'json',
		data:{'jsON':filter},
		beforeSend:function(){},
		success:function(result){
			searchGoodsResponse(result);
		}
	});
}

function searchGoodsResponse(result)
{
  var frm = document.forms['theForm'];
  var sel = frm.elements['goods_id'];

  if (result.error == 0)
  {
    /* 清除 options */
    sel.length = 0;

    /* 创建 options */
    var goods = result.content;
    if (goods)
    {
        for (i = 0; i < goods.length; i++)
        {
            var opt = document.createElement("OPTION");
            opt.value = goods[i].goods_id;
            opt.text  = goods[i].goods_name;
            sel.options.add(opt);
        }
    }
    else
    {
        var opt = document.createElement("OPTION");
        opt.value = 0;
        opt.text  = search_is_null;
        sel.options.add(opt);
    }
  }

  if (result.message.length > 0)
  {
    alert(result.message);
  }
}

</script>